import request from "../utils/http.ts";

import {FoodVO} from "../type/food.ts";

export function getFoodsAPI() {
    return request<FoodVO[]>({
        url: `/food/list`,
        method: 'GET',
    })
}

export function getFoodsByIdAPI(id:number) {
    return request<FoodVO[]>({
        url: `/food/getByBusinessId/${id}`,
        method: 'GET',
    })
}

/**
 * 添加商品
 * @param form
 * */
export function add(form:FormData) {
    return request<FoodVO>({
        url: '/food/add',
        method: 'post',
        data: form
    })
}

/**
 * 删除商品
 * @param id
 * */
export function deleteFoodAPI(id:number) {
    return request<Boolean>({
        url: `/food/delete/${id}`,
        method: 'GET',
    })
}
